﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Reflection;
using System.Text;
using Microsoft.Data.ConnectionUI;
using System.Windows.Forms;
using System.Collections.ObjectModel;

namespace devtm.Editor.Configuration.Data
{

    public class TemplateConnexionStringName: ConfigProperty
    {

        public TemplateConnexionStringName() { }

        List<Object> list = new List<Object>();

        public TemplateConnexionStringName(PropertyInfo propertyinfo, ElementSection instance)
            : base(propertyinfo, instance)
        {                        

            foreach (ConnectionStringSettings item in instance.ConfigurationElement.CurrentConfiguration.ConnectionStrings.ConnectionStrings)
                list.Add(item.Name);
            
            this.Tag = list;

            //string ii = (string)this.Value;
            

        }


        //public virtual Object Value
        //{
        //    get
        //    {
                
        //            string i = (string)base.Value;

        //            if (!list.Contains(i))
        //                IsInError = true;

        //            return i;
                
        //    }
        //    set
        //    {
        //        base.Value = value;
        //    }
        //}


        /// <summary>
        /// Runs the editor.
        /// </summary>       
        public override void RunEditor() { }

        
        ///// <summary>
        ///// Runs the Selector.
        ///// </summary>
        public override void Selector() { }
        
      

    }


}
